home *** CD-ROM | disk | FTP | other *** search
- '\"
- '\" Copyright (c) 1993 The Regents of the University of California.
- '\" Copyright (c) 1994 Sun Microsystems, Inc.
- '\"
- '\" See the file "license.terms" for information on usage and redistribution
- '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '\"
- '\" @(#) split.n 1.2 94/12/17 16:18:50
- '\"
- .so man.macros
- .HS split tcl
- .BS
- '\" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- split \- Split a string into a proper Tcl list
- .SH SYNOPSIS
- \fBsplit \fIstring \fR?\fIsplitChars\fR?
- .BE
-
- .SH DESCRIPTION
- .PP
- Returns a list created by splitting \fIstring\fR at each character
- that is in the \fIsplitChars\fR argument.
- Each element of the result list will consist of the
- characters from \fIstring\fR that lie between instances of the
- characters in \fIsplitChars\fR.
- Empty list elements will be generated if \fIstring\fR contains
- adjacent characters in \fIsplitChars\fR, or if the first or last
- character of \fIstring\fR is in \fIsplitChars\fR.
- If \fIsplitChars\fR is an empty string then each character of
- \fIstring\fR becomes a separate element of the result list.
- \fISplitChars\fR defaults to the standard white-space characters.
- For example,
- .DS
- \fBsplit "comp.unix.misc" .\fR
- .DE
- returns \fB"comp unix misc"\fR and
- .DS
- \fBsplit "Hello world" {}\fR
- .DE
- returns \fB"H e l l o { } w o r l d"\fR.
-
- .SH KEYWORDS
- list, split, string
-